using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.ProcessFlow;
using emp.Utility;

public partial class crm_questionnaire_QuestionnaireSelect : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Params["qur_type"] != null && Request.Params["qur_type"].Equals("") == false)
            {
                hidden_type.Value = Request.Params["qur_type"]; 
            }
                emp.BLL.Questionnaire questBll = new emp.BLL.Questionnaire();
                IList questList = null;
                if (QUR_NAME.Text != null && QUR_NAME.Text.Equals("") == false)
                {
                    questList = questBll.getQunaireList(QUR_NAME.Text, hidden_type.Value,true);
                }
                else
                {
                    questList = questBll.getQunaireList("", hidden_type.Value,true);
                    
                }
                gw_quest.DataSource = questList;
                gw_quest.DataBind();
                PageUtil.setPageCount(gw_quest, questList);
            
        }
    }
    protected void save_Click(object sender, EventArgs e)
    {
        string url = "../campaign/Campaign_Channel.aspx?" + Request.Params["qur_type"] + "quest_uid=" + Request.Params["radioButton"];
       // Campaign_ChannelCotroller cam_chaCotr = new Campaign_ChannelCotroller();
      //  cam_chaCotr.SelectQusetSave(this.hidd_quest_id.Value,this.hidden_type.Value);
        HttpContext.Current.Response.Redirect(url);
    }

    protected void PageChanged(object sender, GridViewPageEventArgs e)
    {

        gview(e.NewPageIndex);

    }

    protected void query_Click(object sender, EventArgs e)
    {
        gview(0);
    }

    private void gview(int page)
    {


        gw_quest.PageIndex = PageUtil.getGviewNewPage(gw_quest, page);
        emp.BLL.Questionnaire questBll = new emp.BLL.Questionnaire();
        IList questList = null;
        if (QUR_NAME.Text != null && QUR_NAME.Text.Equals("") == false)
        {
            questList = questBll.getQunaireList(QUR_NAME.Text, hidden_type.Value,true);
        }
        else
        {
            questList = questBll.getQunaireList("", hidden_type.Value,true);

        }
        gw_quest.DataSource = questList;
        gw_quest.DataBind();

        PageUtil.setPageCount(gw_quest, questList);

    }
    
}
